package com.erclab.xbuilder.repositories;

import com.erclab.internal.xpresso.conf.Settings;
import com.erclab.internal.xpresso.dataAccess.ApplicationDataSource;
import com.erclab.internal.xpresso.repositories.MysqlRepository;

public class XBuilderRepository extends MysqlRepository {

	@Override
	public Object getRepositoryDataSource(String objectName) {
		if (isBuilderObject(objectName)){
			return ((ApplicationDataSource)dataSources.get(Settings.getProperty("xbuilder_app_meta.datasource"))).getTheDataSource();
		} else {
			return repositoryDS;
		}
	}
	
	public boolean isBuilderObject(String objectName){
		return !objectName.endsWith(".xb");
	}


	
	
}
